compute the next permutation

join shbcf.ru